<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <span id="msg">看我72变</span>
    <script>
        var oMsg=document.querySelector("#msg");
        var num=0;

        function randomColor(){
            var str="rgb(";
            str+=parseInt(Math.random()*256)+",";
            str+=parseInt(Math.random()*256)+",";
            str+=parseInt(Math.random()*256)+")";
            return str;
        }

        setInterval(function(){
            num++;
            oMsg.style.color=randomColor();
            oMsg.style.fontSize=12+Math.abs(num)*10+"px";
            if(Math.abs(num)>=6){
                num*=-1;
            }
        },50)
    </script>
</body>
</html>